<?php
//echo 3;
include("../../inc/psa_conect.php");
if (isset($_POST["login"])){
  $sql = "select * from usuarios where usuario = '".$_POST["login"]."' and password='".$_POST["passwd"]."'";
  $result = mysql_query($sql,$link);
  if ($row = mysql_fetch_array($result)){
          setcookie("novell_usuario",$row["usuario"]  ,0,"/");
          setcookie("novell_password",$row["password"],0,"/");
          setcookie("novell_nombre",$row["nombre"]    ,0,"/");
          setcookie("novell_email",""                 ,0,"/");
          setcookie("novell_acceso",$row["acceso"]    ,0,"/");
          setcookie("novell_valido","SI"              ,0,"/");
          header("Location:".$_POST["pagina"]);
          exit;
  }else{
          setcookie("novell_usuario"," " ,0,"/");
          setcookie("novell_password"," ",0,"/");
          setcookie("novell_nombre"," "  ,0,"/");
          setcookie("novell_email",""    ,0,"/");
          setcookie("novell_valido","NO" ,0,"/");

          header("Location:".$_POST["error"]);
          exit;
  }
}
header("Location:login.htm");

?>
